home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / ctrltest / subtest.cpp < prev   
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.1 KB  |  89 lines

  1. // subedit.cpp : SubClassed Edit control example
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1999 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "ctrltest.h"
  15.  
  16. #include "paredit.h"
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // Dialog class
  20.  
  21. class CSubEditDlg : public CDialog
  22. {
  23. protected:
  24.     CParsedEdit edit1, edit2, edit3, edit4;
  25. public:
  26.     //{{AFX_DATA(CSubEditDlg)
  27. #if defined(_WIN32_WCE_PSPC)
  28.     enum { IDD = IDD_SUB_EDIT_PSPC };
  29. #else
  30.     enum { IDD = IDD_SUB_EDIT };
  31. #endif            
  32.     //}}AFX_DATA
  33.     CSubEditDlg()
  34.         : CDialog(CSubEditDlg::IDD)
  35.             { }
  36.  
  37.     BOOL OnInitDialog();
  38.     //{{AFX_MSG(CSubEditDlg)
  39.         virtual void OnOK();
  40.     //}}AFX_MSG
  41.     DECLARE_MESSAGE_MAP()
  42. };
  43.  
  44. BEGIN_MESSAGE_MAP(CSubEditDlg, CDialog)
  45.     //{{AFX_MSG_MAP(CSubEditDlg)
  46.     //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48.  
  49.  
  50. BOOL CSubEditDlg::OnInitDialog()
  51. {
  52.     edit1.SubclassEdit(IDC_EDIT1, this, PES_LETTERS);
  53.     edit2.SubclassEdit(IDC_EDIT2, this, PES_NUMBERS);
  54.     edit3.SubclassEdit(IDC_EDIT3, this, PES_NUMBERS | PES_LETTERS);
  55.     edit4.SubclassEdit(IDC_EDIT4, this, PES_ALL);
  56.     return TRUE;
  57. }
  58.  
  59. void CSubEditDlg::OnOK()
  60. {
  61. #ifdef _DEBUG
  62.     // dump results, normally you would do something with these
  63.     CString s;
  64.     edit1.GetWindowText(s);
  65.     TRACE1("edit1 = '%s'\n", s);
  66.     edit2.GetWindowText(s);
  67.     TRACE1("edit2 = '%s'\n", s);
  68.     edit3.GetWindowText(s);
  69.     TRACE1("edit3 = '%s'\n", s);
  70.     edit4.GetWindowText(s);
  71.     TRACE1("edit4 = '%s'\n", s);
  72. #endif
  73.  
  74.     EndDialog(IDOK);
  75. }
  76.  
  77. /////////////////////////////////////////////////////////////////////////////
  78. // Run the test
  79.  
  80. void CTestWindow::OnTestSubclassedEdit()
  81. {
  82.     TRACE(_T("running dialog containing edit items aliased to ParsedEdits\n"));
  83.     CSubEditDlg dlg;
  84.     dlg.DoModal();
  85. }
  86.  
  87.  
  88. /////////////////////////////////////////////////////////////////////////////
  89.